package com.smart.context;

import com.smart.Car;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

import static org.junit.Assert.assertNotNull;

/**
 * @author chenxingyu
 * @date 2019/8/26 10:56
 */
public class AnnotationApplicationContextTest {
    @Test
    public void getBean() {
        //通过一个带Configuration的POJO 装载Bean配置
        ApplicationContext ctx = new AnnotationConfigApplicationContext(Beans.class);
        Car car = ctx.getBean("car", Car.class);
        assertNotNull(car);
        System.out.println(car);
    }
}
